<!DOCTYPE html>
<html>

  <head>
	<meta charset="UTF-8">
	<title>Xtend - Xtend 2.5.0 Release Notes</title>
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta name="description"
		content="Xtend is a statically typed programming language sitting on top of Java.">
	<meta name="author" content="Sven Efftinge">
	<meta name="author" content="Miro Spoenemann">
	<!--  styles -->
	<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
	<!--[if lt IE 9]>
	  <script src="https://html5shim.googlecode.com/svn/trunk/html5.js"></script>
	<![endif]-->
	
	<!-- Le fav and touch icons -->
	
	<link rel="shortcut icon" href="/Xtext/xtend/images/favicon.png">
	
	<link href="/Xtext/xtend/css/bootstrap.css" rel="stylesheet" type='text/css'>
	<link href="/Xtext/xtend/css/bootstrap-responsive.css" rel="stylesheet" type='text/css'>
	<link href="/Xtext/xtend/css/shield-responsive.css" rel="stylesheet" type='text/css'>
	<link href='/Xtext/xtend/css/fonts.css' rel='stylesheet' type='text/css'>
	<link href="/Xtext/xtend/css/prettyPhoto.css" rel="stylesheet" media="screen" type='text/css'>
	<link href="/Xtext/xtend/css/prettify.css" type="text/css" rel="stylesheet"/>
	<link href="/Xtext/xtend/css/style.css" rel="stylesheet" type='text/css'>
	
	<!--[if lt IE 9]>
	<link href="css/iebugs.css" rel="stylesheet" type='text/css'>
	<![endif]-->

	<!-- BEGIN Cookie Consent
	<link rel="stylesheet" type="text/css" href="//cdnjs.cloudflare.com/ajax/libs/cookieconsent2/3.0.3/cookieconsent.min.css" />
	<script src="//cdnjs.cloudflare.com/ajax/libs/cookieconsent2/3.0.3/cookieconsent.min.js"></script>
	<script>
	window.addEventListener("load", function(){
	window.cookieconsent.initialise({
		"palette": {
		"popup": {
		  "background": "#000"
		},
		"button": {
		  "background": "#f1d600"
		}
		},
		"theme": "edgeless",
		"type": "opt-in",
		onInitialise: function (status) {
		  var type = this.options.type;
		  var didConsent = this.hasConsented();
		  if (type == 'opt-in' && didConsent) {
		    // TODO: enable cookies
		  }
		  if (type == 'opt-out' && !didConsent) {
		    // TODO: disable cookies
		  }
		},
		onStatusChange: function(status, chosenBefore) {
		  var type = this.options.type;
		  var didConsent = this.hasConsented();
		  if (type == 'opt-in' && didConsent) {
		    // TODO: enable cookies
		  }
		  if (type == 'opt-out' && !didConsent) {
		    // TODO: disable cookies
		  }
		}, 
		onRevokeChoice: function() {
		  var type = this.options.type;
		  if (type == 'opt-in') {
		    // TODO: disable cookies
		  }
		  if (type == 'opt-out') {
		    // TODO: enable cookies
		  }
		},
		"content": {
		"href": "https://www.eclipse.org/legal/privacy.php"
		}
	})});
	</script>
	END Cookie Consent -->
</head>


  <body>

    <!-- Navbar -->
  <div class="navbar navbar-fixed-top"
    style="border-bottom: 1px solid #000;">
    <div class="navbar-inner">
      <div class="container">
        <a class="btn btn-navbar" data-toggle="collapse"
          data-target=".nav-collapse"> <span class="icon-bar"></span> <span
          class="icon-bar"></span> <span class="icon-bar"></span>
        </a> <a class="brand" href="/Xtext/xtend/index.html"></a>
        <div class="nav-collapse collapse" style="height: 0px;">
          <ul class="nav">
            <li ><a href="/Xtext/xtend/download.html">Download</a></li>
            <li ><a href="/Xtext/xtend/documentation/index.html">Documentation</a></li>
            <li ><a href="/Xtext/xtend/community.html">Community</a></li>
            <li ><a href="https://eclipse.dev/Xtext">Xtext</a></li>
            <li ><a href="https://www.eclipse.org">Eclipse.org</a></li>
          </ul>
              <!--div class="btn-group pull-right">
                <div class="g-plusone" data-href="https://eclipse.dev/Xtext/xtend"></div>
              </div-->
        </div>
        <!--/.nav-collapse -->
      </div>
    </div>
  </div>
  <!-- Navbar End -->


    <div class="post">

  <header class="post-header">
    <h1 class="post-title">Xtend 2.5.0 Release Notes</h1>
    <p class="post-meta">Dec 11, 2013</p>
  </header>

  <article class="post-content">
    <p>
  With over <a href="https://goo.gl/7zorrn">100 bugfixes</a>, Version 2.5.0 is mainly a bugfix and
  performance release. The team has been working on ironing out any glitches in the user experience
  and further improving a fluent workflow with the language and the tools.
</p>

<section id="annotations_2_5" style="padding-top: 68px; margin-top: -68px;">
  <h3>Full support for Java 7 Annotations</h3>
  <p>
	The Xtend compiler now supports all annotation values and constant expressions in annotations.
	These annotation can be evaluated during compilation within active annotations. Also all values
	supported in Java can now be set during annotation processing.
  </p>
<pre class="prettyprint lang-xtend linenums">
annotation Columns {
  Column[] value = #[ @Column('id') ]
}
annotation Column {
  String value
  int length = 2 << 16
}
</pre>
<pre class="prettyprint lang-xtend linenums">
class Entity {
  @Columns(#[@Column('id'), @Column(value = 'timestamp', length = 2 * 3 * 7)])
  CompositeKey key
}
</pre>
</section>
<section id="compiler_checks_2_5" style="padding-top: 68px; margin-top: -68px;">
  <h3>Improved compiler checks</h3>
  <p>
	The Xtend compiler now detects ambiguously overloaded methods.
  </p>
  <h3 id="ambiguous_methods">Method overload validation</h4>
  <p>
	Ambiguous method invocations are checked and reported with a detailled message.
	The compiler optionally detects valid but suspiciously overloaded methods
	that could be implemented by accident. This is especially handy when property access and 
	extension methods come into play.
  </p>
<pre class="prettyprint lang-xtend linenums">
class A {
  def isCheck() {..}
}
class B extends A {
  def m() {
	/*
	 * Ambiguous feature call.
	 * The methods
	 *     getCheck() in B and
	 *     isCheck() in A
	 * both match.
	 */ 
	this.check
  }
  def getCheck() {..}
}
</pre>
  <em>Important note:</em>
  <p>
	You have to make sure to use the library in version 2.5 along with the introduced compiler checks.
  </p>
  <h3 id="discouraged_variable_names">Discouraged variable names</h4>
  <p>
	Some variable names are used implicitely by Xtend, for example the variable name 'self'.
	The compiler optionally reports if these names were picked manually.
  </p>
</section>
<section id="language_enhancements_2_5" style="padding-top: 68px; margin-top: -68px;">
  <h3>Small language enhancements</h3>
  <p>
	Some refinements have been made to the Xtend language semantics to improve the overall experience.
  </p>
  <h3 id="improved_auto_casts">Auto casts</h4>
  <p>
	Xtend supported auto-casts right from the beginning with its powerful switch expression.
	In 2.5, the more familiar syntax with instance-of checks caught up and also applies automatic
	casts in if expressions and while loops. 
  </p>
<pre class="prettyprint lang-xtend linenums">
def m(CharSequence c) {
  if (c instanceof String) {
	c.substring(42)
  }
}
</pre>
  <h3 id="switch_enum">Switch over enums</h4>
  <p>
	One of the few places where Xtend's syntax could be improved compared to Java, was a switch expression
	over enumeration values. Now it's no longer necessary to use a qualified name or static imports for the enum values but
	the literals are available automatically for the case guards. 
  </p>
<pre class="prettyprint lang-xtend linenums">
def m(RetentionPolicy p) {
  switch p {
	case CLASS: 1
	case RUNTIME: 2
	case SOURCE: 3
  }
}
</pre> 
</section>
<section id="template_expression_2_5" style="padding-top: 68px; margin-top: -68px;">
  <h3>Customizable template expression</h3>
  <p>
	The template expressions can now be semantically enhanced via target typing.
	One use case is code generation where imports are automatically added when concatenating a type
	or if the appended object does not have a proper string representation. It is also possible
	to pass an explicit line delimiter rather than using the platform default.
  </p>
<pre class="prettyprint lang-xtend linenums">
def StringConcatenationClient m() '''my template''' // uses target type

// caller code
val result = new StringConcatenation(lineDelimiter) // custom line delimiter or subtype
result.append(m)
return result.toString()
</pre>
</section>
<section id="primitive_types_2_5" style="padding-top: 68px; margin-top: -68px;">
  <h3>Improved type inference with primitive values</h3>
  <p>
	The local type inference has been improved when primitive types are involved. Their wrapper
	types will be used in fewer cases which prevents unexpected exceptions at runtime.
	An optional compiler check can point to places where primitive defaults are used rather than
	explicit values.
  </p>
</section>
<section id="mvn_android_2_5" style="padding-top: 68px; margin-top: -68px;">
  <h3>Better experience with Maven and Android</h3>
  <p>
	The Android archetype for Maven was improved. It
	properly configures the compiler and debug settings, uses the latest Android libraries and the produced
	Eclipse project matches the structure that is created by the ADT wizards.
  </p>
</section>

  </article>

</div>

    
    <footer class="site-footer">
  <div id="extra">
    <div class="container inner-footer">
      <div class="row">
        <div class="span6">
          <h3 class="footer-links-header">Quick Links</h3>
          <ul class="footer-links clearfix">
            <li><a href="https://www.eclipse.org/legal/privacy.php">Privacy Policy</a></li>
            <li><a href="https://www.eclipse.org/legal/termsofuse.php">Terms of Use</a></li>
            <li><a href="https://www.eclipse.org/legal/copyright.php">Copyright Agent</a></li>
            <li><a href="https://www.eclipse.org/legal/">Legal</a></li>
          </ul>
          <ul class="footer-links clearfix">
            <li><a href="https://www.eclipse.org">Eclipse Home</a></li>
            <li><a href="https://marketplace.eclipse.org/">Market Place</a></li>
            <li><a href="https://www.planeteclipse.org/">Eclipse Planet</a></li>
            <li><a href="https://www.eclipse.org/forums/index.php/f/27/">Xtext Forum</a></li>
          </ul>
        </div>
        <div class="span6">
            <!-- Social Media Links -->
            <h3 class="footer-links-header"">Social Media</h3>
            <ul class="footer-links clearfix">
              <li>
                <a href="https://twitter.com/xtendlang"><img src="/Xtext/xtend/images/Twitter-bird-darkgray.png" class="img-responsive" style="margin-right: 5px;height: 1em;" alt="Twitter icon">@xtendlang on Twitter</a>
              </li>
            </ul>
          </div>

      </div>
    </div>
  </div>
  <a href="#" class="scrollup fadeOutRight animated" style="display: none;">ScrollUp</a>
  <a href="https://dryicons.com/">Icons by https://dryicons.com</a>
  <!-- Le javascript
      ================================================== -->
  <!-- Placed at the end of the document so the pages load faster -->
  <script src="/Xtext/xtend/js/jquery-1.7.1.min.js" type="text/javascript"></script>
  <script src="/Xtext/xtend/js/bootstrap.min.js" type="text/javascript"></script>
  
  <!-- include pretty-print files -->
  <script src="/Xtext/xtend/js/prettify.js" type="text/javascript" ></script>
  <script src="/Xtext/xtend/js/lang-xtend.js" type="text/javascript"></script>
  
  <!-- Include the plug-in -->
  <script src="/Xtext/xtend/js/jquery.prettyPhoto.js" type="text/javascript"></script>
  <script src="/Xtext/xtend/js/jquery.easing.1.3.js" type="text/javascript"></script>
  <script src="/Xtext/xtend/js/custom.js" type="text/javascript"></script>
  <!--script src="https://apis.google.com/js/platform.js" async defer></script-->
  <!--script type="text/javascript">
    var _gaq = _gaq || [];  
      _gaq.push([ '_setAccount', 'UA-2429174-4' ]);
    _gaq.push([ '_trackPageview' ]);
    (function() {
      var ga = document.createElement('script');
      ga.type = 'text/javascript';
      ga.async = true;
      ga.src = ('https:' == document.location.protocol ? 'https://ssl'
          : 'https://www')
          + '.google-analytics.com/ga.js';
      var s = document.getElementsByTagName('script')[0];
      s.parentNode.insertBefore(ga, s);
    })();
  </script-->
</footer>

  </body>

</html>
